
<?php
require "../common/SqlUtils.php";
$key = $_COOKIE["userkey"];
session_start();
$userName = '';
$is_login = false;
if(!isset($_SESSION[$key])){
    $userName= "你尚未登入，<a href='/login.php'>请登入</a>";
}else{
    $username = $_SESSION[$key]["username"];
    $psd = $_SESSION[$key]["psd"];
    SqlUtils::$conn=new mysqli("127.0.0.1","root","123456","bank");
    $sql="SELECT RealName from accountinfo WHERE AccountId=(select AccountId from bankcard WHERE CardNo='".$username."' and CardPwd='".$psd."')";
    $result=SqlUtils::select($sql);
    print_r($result);
    exit();
    $userName=$result[0]["RealName"];
    $is_login = true;
}

$logUrl =  '../public/image/'.$_GET['log'];

?>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<p><?php echo $userName;?><a href="logout.php">退出</a></p>
        <?php if($is_login) {?>
            <a href="changePassword_page.php"><button type="button">修改密码</button></a>
            <p>头像：<img src="<?php echo $logUrl;?>" ></p>

            <form action="img.php" method="post" enctype="multipart/form-data">
                <input type="file" name="file">
                <br/>
                <button type="submit">上传头像</button>
            </form>
        <?php } ?>
	</body>

</html>
